 /* Author : Maisa Nurul Agnia 091511055  & Putri Andita R 091511059
 * Proyek 4*/

package jtk.project4.fleet.screen.newEditSchedule;

import java.sql.SQLException;

import jtk.project4.fleet.FleetModel;
import jtk.project4.fleet.domain.PmHist;
import jtk.project4.fleet.domain.SchData;
import jtk.project4.fleet.domain.Schedules;
import jtk.project4.fleet.event.NewEditScheduleEvent;
import jtk.project4.fleet.event.PMScheduleSetupEvent;
import jtk.project4.fleet.screen.newEditSchedule.newEditScheduleView;
import nl.coderight.jazz.Controller;

public class newEditScheduleController extends Controller{

	private newEditScheduleView newEditScheduleView;
	private FleetModel fleetModel;
	public void handleEvent(PMScheduleSetupEvent evt) throws SQLException {
		Schedules Schedule = fleetModel.getSchedule();
		switch (evt.getType()) {
		case NEW:
			executeController(new newEditScheduleController());
			break;
		
		case SAVE:
			fleetModel.insertSchedule(Schedule);
			break;
		default:
			propagateEvent(evt);
			break;
			
		}
	}
	
	
	@Override
	
	public void execute() {
		// TODO Auto-generated method stub
		fleetModel = (FleetModel) getModel();
		newEditScheduleView = new newEditScheduleView();
		setView(newEditScheduleView);
		showView();
	}

}
